﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using AutoFacUtils;
using CashFlow.Db.Repository;
using CashFlow.Web.Common;
using CashFlow.Web.Def;
using CashFlow.Web.Service;

namespace CashFlow.Web.Validator
{
    public class CommonValidator
    {
        private static IOrderRepository GetOrderRepository() { return AutoFacHelper.Get<IOrderRepository>(); }
        private static IOrderService GetOrderService() { return AutoFacHelper.Get<IOrderService>(); }
        private static IUserService GetUserService() { return AutoFacHelper.Get<IUserService>(); }

        public static bool IsLegalUploadFile(
            HttpPostedFileBase file
            , int maxSize = 1000 * 1024)
        {
            if (file != null)
            {
                if (file.ContentLength > 0
                    && file.ContentLength <= maxSize)
                {
                    return true;
                }
            }

            return false;
        }
    }
}